﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using _3.Datos.Seguridad;
using _4.Modelado.Seguridad;

namespace _2.Logica.Seguirdad
{
    public class AreaL:Negocio
    {
        public void AreaGuardar(Area obj)
        {
            try
            {
                IniciarTransanccion();


                var objBD = new  AreaBD();

                objBD.AreaGuardar(comando, obj);

                ConfirmarTransaccion();
                
            }
            catch (Exception e)
            {
                DeshacerTransaccion();
                throw e;
            }
        }

   

        public void AreaEliminar(Area obj)
        {
            try
            {
                this.IniciarTransanccion();

                var objBD = new AreaBD();

                objBD.AreaEliminar(this.comando, obj);

                this.ConfirmarTransaccion();

            }
            catch (Exception e)
            {
                this.DeshacerTransaccion();
                throw e;
            }
        }

        public List<Area> AreasConsultar()
        {
            try
            {
                IniciarTransanccion();

                var objBD = new AreaBD();

                List<Area> lista = objBD.AreasConsultar(this.comando);

                CerrarConexion();

                return lista;
            }
            catch (Exception exc)
            {
                CerrarConexion();
                throw exc;
            }
        }

        public DataTable LlenarComboArea()
        {
            try
            {
                IniciarTransanccion();

                var objBD = new AreaBD();

                DataTable lista = objBD.LlenarComboArea(this.comando);

                CerrarConexion();

                return lista;
            }
            catch (Exception exc)
            {
                CerrarConexion();
                throw exc;
            }
        }

    }
}
